<div id = "user_details">

    <?php

    $query = "select * from ADS where ad_id = ".$ad_id;
    $results = $set->qry($query);
    $row = mysql_fetch_assoc($results);
	
	
	// Μέθοδος για να γίνεται check το checkbox όταν είναι approved=1 μια αγγελία 
    function approved($appr){
        if ($appr == 1)		
        	return 'checked';
		else 
			return;
    }
	

    ?>

    <div>
        <form action=<?php echo "advertisements.php?id=".$ad_id."&action=edit"?> method="post">

        <table class="table_search">
            <tr>
                <td>Title</td>
                <td><input id="adtitle" class="search_input" type="text" name="adtitle" value="<?php echo $row['ad_title'];?>"></td>
            </tr>
            <tr>
                <td>Description</td>
                <td><input id="addesc" class="search_input" type="text" name="addesc" value="<?php echo $row['ad_desc'];?>"></td>
            </tr>
            <tr>
                <td>Code</td>
                <td><input id="adcode" class="search_input" type="text" name="adcode" value="<?php echo $row['ad_code'];?>"></td>
            </tr>
            <tr>
                <td>Type</td>
                <td><input id="adtype" class="search_input" type="text" name="adtype" value="<?php echo $row['ad_type'];?>"></td>
            </tr>
            <tr>
                <td>Salary</td>
                <td><input id="adsal" class="search_input" type="text" name="adsal" value="<?php echo $row['ad_salary'];?>"></td>
            </tr>            
            <tr>
                <td>Date</td>
                <td><input id="addate" class="search_input" type="text" name="addate" value="<?php echo $row['ad_date'];?>"></td>
            </tr>
            <tr>
                <td>Email</td>
                <td><input id="ademail" class="search_input" type="text" name="ademail" value="<?php echo $row['ad_email'];?>"></td>
            </tr>
            <tr>
                <td>Location</td>
                <td><input id="adloc" class="search_input" type="text" name="adloc" value="<?php echo $row['user_autocomplete'];?>"></td>
            </tr>            
            <tr>                                
                <td><input id="adOK" type="checkbox" name="adOK" value='TRUE' <?php echo approved($row['ad_isAproved'])?>>Approved<br></td>                
            </tr>            
            </table>
        <table class="table_search">
            <tr>
                <td>
                    <input type="image" src="imgs/edit-icon.png"alt="edit" title="edit" width="50px">
                </td>
                <td>
                    <a href=<?php echo "advertisements.php?id=".$ad_id."&action=delete"?>><img src="imgs/delete_icon.png" alt="delete" title="delete" width="50px"></a>
                </td>
                <td>
                    <a href=<?php echo "advertisements.php?id=".$ad_id."&action=new"?>><img src="imgs/new_icon.png" alt="new" title="new" width="50px"></a>
                </td>
            </tr>
        </table>
    </div>
    </form>
</div>